t = int (input ());
for i in range (t) :
n, k = map (int, input ().split ());
tmp1 = n - 2 * (k - 1);
tmp2 = n - (k - 1);
if ((tmp1 > 0) and (tmp1 % 2 == 0)) :
print ("YES");
print ("2 " * (k - 1), tmp1, sep='');
elif ((tmp2 > 0) and (tmp2 % 2 == 1)) :
print ("YES");
print ("1 " * (k - 1), tmp2, sep='');
else :
print ("NO");
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--)
{
int n,k,m;
cin>>n>>k;
m=n;
for(int i=1; i<k; i++)
{
n=n-2;
m=m-1;
}
if((n%2!=0||n<2)&&(m%2==0||m<1))
cout<<"NO"<<endl;
else if(n%2==0&&n>=2)
{
cout<<"YES"<<endl<<n<<" ";
for(int j=1; j<k; j++)
cout<<"2"<<" ";
cout<<endl;
}
else if(m%2!=0&&m>=1)
{
cout<<"YES"<<endl<<m<<" ";
for(int j=1; j<k; j++)
cout<<"1"<<" ";
cout<<endl;
}
}
return 0;
}
1624C - Division by Two and Permutation | 1288A - Deadline |
1617A - Forbidden Subsequence | 914A - Perfect Squares |
873D - Merge Sort | 1251A - Broken Keyboard |
463B - Caisa and Pylons | 584A - Olesya and Rodion |
799A - Carrot Cakes | 1569B - Chess Tournament |
1047B - Cover Points | 1381B - Unmerge |
1256A - Payment Without Change | 908B - New Year and Buggy Bot |
979A - Pizza Pizza Pizza | 731A - Night at the Museum |
742A - Arpa’s hard exam and Mehrdad’s naive cheat | 1492A - Three swimmers |
1360E - Polygon | 1517D - Explorer Space |
1230B - Ania and Minimizing | 1201A - Important Exam |
676A - Nicholas and Permutation | 431A - Black Square |
474B - Worms | 987B - High School Become Human |
1223A - CME | 1658B - Marin and Anti-coprime Permutation |
14B - Young Photographer | 143A - Help Vasilisa the Wise 2 |